/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vn.com.aptech.msh.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author trietto
 */
@Entity
@Table(name = "faq")
@NamedQueries({
    @NamedQuery(name = "Faq.findAll", query = "SELECT f FROM Faq f")})
public class Faq implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "FaqID")
    private Integer faqID;
    @Basic(optional = false)
    @Column(name = "Question")
    private String question;
    @Basic(optional = false)
    @Column(name = "Answer")
    private String answer;
    @JoinColumn(name = "FaqGroupID", referencedColumnName = "FaqGroupID")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private FaqGroup faqGroup;

    public Faq() {
    }

    public Faq(Integer faqID) {
        this.faqID = faqID;
    }

    public Faq(Integer faqID, String question, String answer) {
        this.faqID = faqID;
        this.question = question;
        this.answer = answer;
    }

    public Integer getFaqID() {
        return faqID;
    }

    public void setFaqID(Integer faqID) {
        this.faqID = faqID;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public String getAnswer() {
        return answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer;
    }

    public FaqGroup getFaqGroup() {
        return faqGroup;
    }

    public void setFaqGroup(FaqGroup faqGroup) {
        this.faqGroup = faqGroup;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (faqID != null ? faqID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Faq)) {
            return false;
        }
        Faq other = (Faq) object;
        if ((this.faqID == null && other.faqID != null) || (this.faqID != null && !this.faqID.equals(other.faqID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vn.com.aptech.msh.entities.Faq[faqID=" + faqID + "]";
    }

}
